package com.xdemo.handler;

import com.xdemo.core.MessageType;
import com.xdemo.core.msg.TestExchangeMessage;
import com.xdemo.msg.IMessage;

public class TestExchangeAction implements IMessageAction<Integer> {
	
	public Integer[] types = {MessageType.TestExchange};

	@Override
	public void doAction(IMessage<Integer> message) {
		switch(message.getType()) {
		case MessageType.TestExchange:
			TestExchangeMessage _msg = (TestExchangeMessage)message;
			System.out.println(_msg.getValue());
			_msg.setValue(_msg.getValue() + 1);
			_msg.getServer().sendMessage(_msg);
		}
	}

	@Override
	public Integer[] getTypes() {
		return types;
	}

}
